package ui;

import java.awt.*;
import java.awt.event.*;

import java.awt.BorderLayout;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import javax.swing.AbstractAction;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JToolBar;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;

import javax.swing.*;
import java.awt.Graphics;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JPanel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JTable;
import javax.swing.LayoutStyle.ComponentPlacement;

import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import javax.swing.border.EtchedBorder;

import ui.*;

import controller.*;
public class HelpWindow extends JFrame {

	private static HelpWindow instance = null;
	private JMenuBar jMenuBar;
	private JMenu jMenu;
	private JMenuItem back;
	private JMenuItem signOut;
	private Border pEdge;
	private JPanel sales;
	private JLabel salesLabelText;
	private JLabel salesLabelTextA;
	private JLabel salesLabel;
	private JPanel rents;
	private JLabel rentsLabelText;
	private JLabel rentsLabel;
	private JPanel emp;
	private JLabel empLabelText;
	private JLabel empLabel;
	private JPanel cus;
	private JLabel cusLabelText;
	private JLabel cusLabel;
	private JPanel main;
	private JLabel mainLabelText;
	private JLabel mainLabel;
	private JPanel product;
	private JLabel productLabelText;
	private JLabel productLabel;
	private JPanel stats;
	private JLabel statsLabelText;
	private JLabel statsLabel;
	private LoginMenu loginMenu;
	private MainUI mainUI;
	private ImageIcon salesUI;
	private ImageIcon rentUI;
	private ImageIcon customerUI;
	private ImageIcon employeeUI;
	private ImageIcon mainUIIc;
	private ImageIcon prodUI;
	private ImageIcon statsUI;
	private MainUI MainUI; 
	
	
	public static HelpWindow getInstance()
	{
		if(instance == null)
		{
			instance = new HelpWindow();
		}
		return instance;
	}
	
	public HelpWindow()
	{
		//MainUI.getInstance();
		jMenuBar = new JMenuBar();
		
		jMenu = new JMenu("Options");
		
		back = new JMenuItem("Back");
		event goBack = new event();
		back.addActionListener(goBack);
		jMenu.add(back);
		
		signOut = new JMenuItem("Sign Out");
		event2 leave = new event2();
		signOut.addActionListener(leave);
		jMenu.add(signOut);
		
		setJMenuBar(jMenuBar);
		getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.X_AXIS));
		
		JPanel panel = new JPanel();
		getContentPane().add(panel);
		panel.setLayout(null);
		
		JLabel lblSales = new JLabel("Sales");
		lblSales.setBounds(35, 11, 25, 14);
		panel.add(lblSales);
		
		JLabel lblFeatures = new JLabel("features:");
		lblFeatures.setBounds(10, 27, 46, 14);
		panel.add(lblFeatures);
		
		JLabel lblCreatingSales = new JLabel("Creating Sales");
		lblCreatingSales.setBounds(22, 43, 69, 14);
		panel.add(lblCreatingSales);
		
		JLabel lblEditingSales = new JLabel("Editing Sales");
		lblEditingSales.setBounds(23, 57, 66, 14);
		panel.add(lblEditingSales);
		
		JLabel lblDifferentStages = new JLabel("Different Stages");
		lblDifferentStages.setBounds(23, 72, 89, 14);
		panel.add(lblDifferentStages);
		
		JLabel lblInformationAboutCustomer = new JLabel("Customer information");
		lblInformationAboutCustomer.setBounds(23, 88, 103, 14);
		panel.add(lblInformationAboutCustomer);
		
		JLabel lblRents = new JLabel("Rents");
		lblRents.setBounds(182, 11, 34, 14);
		panel.add(lblRents);
		
		JLabel label_1 = new JLabel("features:");
		label_1.setBounds(157, 27, 46, 14);
		panel.add(label_1);
		
		JLabel lblCreatingRents = new JLabel("Creating Rents");
		lblCreatingRents.setBounds(169, 43, 79, 14);
		panel.add(lblCreatingRents);
		
		JLabel lblEditingRents = new JLabel("Editing Rents");
		lblEditingRents.setBounds(170, 57, 66, 14);
		panel.add(lblEditingRents);
		
		JLabel label_4 = new JLabel("Different Stages");
		label_4.setBounds(170, 72, 89, 14);
		panel.add(label_4);
		
		JLabel label_5 = new JLabel("Customer information");
		label_5.setBounds(170, 88, 103, 14);
		panel.add(label_5);
		
		JLabel lblEmployeeInformation = new JLabel("Employee information");
		lblEmployeeInformation.setBounds(23, 105, 103, 14);
		panel.add(lblEmployeeInformation);
		
		JLabel label = new JLabel("Employee information");
		label.setBounds(170, 105, 103, 14);
		panel.add(label);
		
		JLabel lblProductLocation = new JLabel("Product Location");
		lblProductLocation.setBounds(321, 88, 103, 14);
		panel.add(lblProductLocation);
		
		JLabel lblManageronly = new JLabel("Manager-only");
		lblManageronly.setBounds(321, 72, 89, 14);
		panel.add(lblManageronly);
		
		JLabel lblEditingProducts = new JLabel("Editing Products");
		lblEditingProducts.setBounds(321, 57, 78, 14);
		panel.add(lblEditingProducts);
		
		JLabel lblAddProducts = new JLabel("Add Products");
		lblAddProducts.setBounds(320, 43, 79, 14);
		panel.add(lblAddProducts);
		
		JLabel label_9 = new JLabel("features:");
		label_9.setBounds(308, 27, 46, 14);
		panel.add(label_9);
		
		JLabel lblProducts = new JLabel("Products");
		lblProducts.setBounds(333, 11, 54, 14);
		panel.add(lblProducts);
		
		JLabel lblCustomers = new JLabel("Customers");
		lblCustomers.setBounds(35, 130, 56, 14);
		panel.add(lblCustomers);
		
		JLabel label_3 = new JLabel("features:");
		label_3.setBounds(10, 146, 46, 14);
		panel.add(label_3);
		
		JLabel lblCreatingCustomers = new JLabel("Creating Customers");
		lblCreatingCustomers.setBounds(22, 162, 104, 14);
		panel.add(lblCreatingCustomers);
		
		JLabel lblEditingCustomers = new JLabel("Editing Customers");
		lblEditingCustomers.setBounds(23, 176, 89, 14);
		panel.add(lblEditingCustomers);
		
		JLabel lblTypesOfCustomers = new JLabel("Types of Customers");
		lblTypesOfCustomers.setBounds(23, 191, 96, 14);
		panel.add(lblTypesOfCustomers);
		
		JLabel lblInformationReview = new JLabel("Information Review");
		lblInformationReview.setBounds(23, 207, 103, 14);
		panel.add(lblInformationReview);
		
		JLabel lblCreatingEmployees = new JLabel("Creating Employees");
		lblCreatingEmployees.setBounds(169, 162, 104, 14);
		panel.add(lblCreatingEmployees);
		
		JLabel label_6 = new JLabel("features:");
		label_6.setBounds(157, 146, 46, 14);
		panel.add(label_6);
		
		JLabel lblEmployees = new JLabel("Employees");
		lblEmployees.setBounds(182, 130, 56, 14);
		panel.add(lblEmployees);
		
		JLabel lblEditingEmployees = new JLabel("Editing Employees");
		lblEditingEmployees.setBounds(170, 176, 89, 14);
		panel.add(lblEditingEmployees);
		
		JLabel lblTypesOfEmployees = new JLabel("Types of Employees");
		lblTypesOfEmployees.setBounds(170, 191, 96, 14);
		panel.add(lblTypesOfEmployees);
		
		JLabel lblEmployeeInformation_1 = new JLabel("Employee information");
		lblEmployeeInformation_1.setBounds(170, 207, 103, 14);
		panel.add(lblEmployeeInformation_1);
		
		JLabel lblTotalPrices = new JLabel("Total Prices");
		lblTotalPrices.setBounds(307, 191, 96, 14);
		panel.add(lblTotalPrices);
		
		JLabel lblTotalRents = new JLabel("Total Rents");
		lblTotalRents.setBounds(307, 176, 89, 14);
		panel.add(lblTotalRents);
		
		JLabel lblTotalSales = new JLabel("Total Sales");
		lblTotalSales.setBounds(306, 162, 104, 14);
		panel.add(lblTotalSales);
		
		JLabel label_11 = new JLabel("features:");
		label_11.setBounds(294, 146, 46, 14);
		panel.add(label_11);
		
		JLabel lblStatistics = new JLabel("Statistics");
		lblStatistics.setBounds(319, 130, 56, 14);
		panel.add(lblStatistics);
		
		pEdge = BorderFactory.createLineBorder(Color.black);
		
		
		salesLabelText = new JLabel("In the sales interface a user can :");
		salesLabelTextA = new JLabel("Access sales in different stages [buttons A to C]");
		
		
		
		
		setVisible(true);
	}
	
	public class event implements ActionListener
	{
		public void actionPerformed(ActionEvent back)
		{
			try{
				ui.MainUI.main(null);
				setVisible(false);
			} catch (Exception e) {
				e.printStackTrace();
			}
			
		}
	}
	
	public class event2 implements ActionListener
	{
		public void actionPerformed(ActionEvent leave)
		{
			try{
				LoginMenu.logOut();
				setVisible(false);
			} catch ( Exception e) {
				e.printStackTrace();
			}
		}
	}
	
	public static void main(String args[])
	{
		try {
           
        UIManager.setLookAndFeel(
            UIManager.getSystemLookAndFeelClassName());
    } 
    catch (UnsupportedLookAndFeelException e) {
       // handle exception
    }
    catch (ClassNotFoundException e) {
       // handle exception
    }
    catch (InstantiationException e) {
       // handle exception
    }
    catch (IllegalAccessException e) {
       // handle exception
    }
		HelpWindow gui = new HelpWindow();
		gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		gui.pack();
		gui.setLocationRelativeTo(null);
		gui.setTitle("Help");
		gui.setResizable(false);
		//gui.setVisible(true);
	}
}
